package com.wx.service.imp;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wx.dao.StudentDao;
import com.wx.entity.Student;
import com.wx.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class StudentServiceImp implements StudentService {

    @Autowired
    private StudentDao studentDao;
    @Override
    public List<Student> findAll() {
        return studentDao.findAll();
    }

    @Override
    public void add(Student student) {
        Student student1 = new Student(102, "事务111", 251l, 2l);
        studentDao.add(student1);
        int j=1/0;
        studentDao.add(student);
    }

    @Override
    public PageInfo findByPage() {
        PageHelper.startPage(1,3);
        List<Student> all = studentDao.findAll();
        PageInfo<Student> info = new PageInfo<>(all);
        return info;
    }


}
